package com.gec.zhs.controller;

import java.util.List;

import com.gec.zhs.entity.query.OpenjobQuery;
import com.gec.zhs.entity.po.Openjob;
import com.gec.zhs.entity.vo.ResponseVO;
import com.gec.zhs.service.OpenjobService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 定时任务 Controller
 */
@RestController("openjobController")
@RequestMapping("/openjob")
public class OpenjobController extends ABaseController{

	@Resource
	private OpenjobService openjobService;
	/**
	 * 根据条件分页查询
	 */
	@RequestMapping("/loadDataList")
	public ResponseVO loadDataList(OpenjobQuery query){
		return getSuccessResponseVO(openjobService.findListByPage(query));
	}

	/**
	 * 新增
	 */
	@RequestMapping("/add")
	public ResponseVO add(Openjob bean) {
		openjobService.add(bean);
		return getSuccessResponseVO(null);
	}

	/**
	 * 批量新增
	 */
	@RequestMapping("/addBatch")
	public ResponseVO addBatch(@RequestBody List<Openjob> listBean) {
		openjobService.addBatch(listBean);
		return getSuccessResponseVO(null);
	}

	/**
	 * 批量新增/修改
	 */
	@RequestMapping("/addOrUpdateBatch")
	public ResponseVO addOrUpdateBatch(@RequestBody List<Openjob> listBean) {
		openjobService.addBatch(listBean);
		return getSuccessResponseVO(null);
	}

	/**
	 * 根据Id查询对象
	 */
	@RequestMapping("/getOpenjobById")
	public ResponseVO getOpenjobById(String id) {
		return getSuccessResponseVO(openjobService.getOpenjobById(id));
	}

	/**
	 * 根据Id修改对象
	 */
	@RequestMapping("/updateOpenjobById")
	public ResponseVO updateOpenjobById(Openjob bean,String id) {
		openjobService.updateOpenjobById(bean,id);
		return getSuccessResponseVO(null);
	}

	/**
	 * 根据Id删除
	 */
	@RequestMapping("/deleteOpenjobById")
	public ResponseVO deleteOpenjobById(String id) {
		openjobService.deleteOpenjobById(id);
		return getSuccessResponseVO(null);
	}
}